package com.eugene.ui.provider;

import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;

import com.eugene.element.FnCalendar;
import com.eugene.element.MarketVariable;
import com.eugene.element.MarketVariableDetail;
import com.eugene.entity.MarketVariableDAO;
import com.eugene.enums.EMarketVariableType;
import com.eugene.enums.EMaturity;

public class MarketVariableContent implements ITreeContentProvider{
	private MarketVariable marketVariable;

	@Override
	public void dispose() {
	}

	@Override
	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
//		this.marketVariable = (MarketVariable) newInput;
	}

	@Override
	public Object[] getElements(Object inputElement) {
		return EMarketVariableType.values();
	}

	@Override
	public Object[] getChildren(Object parentElement) {
		if (parentElement instanceof EMarketVariableType) {
			switch ((EMarketVariableType)parentElement) {
				case IR:
					return MarketVariableDAO.getMarketVariable().toArray();
				default:
					break;
			}
		}
//		else {
//			return null;
//		}
		return null;
	}

	@Override
	public Object getParent(Object element) {
		return null;
	}

	@Override
	public boolean hasChildren(Object element) {
		if (element instanceof EMarketVariableType) {
			return true;
		}
//		return true;
		return false;
	}
	
//	@Override
//	public void addListenerTo(){
		
//	}
}
